﻿using RemoteSensingImageDirectServer.Models.Request.Listener;
using RemoteSensingImageDirectServer.Models.Request.Validation;
using System.ComponentModel.DataAnnotations;

namespace RemoteSensingImageDirectServer.Models.Request.Params.OGC.RasterMap
{
    public class GroupWMSParams : IWMSListener, IImageListener, ICapabilitiesListener, IStretchListener
    {
        /// <summary>
        /// 图层名称
        /// </summary>
        [Required]
        public string Layers { get; set; }

        /// <summary>
        /// 宽度
        /// </summary>
        public int Width { get; set; }

        /// <summary>
        /// 高度
        /// </summary>
        public int Height { get; set; }

        /// <summary>
        /// 四至范围
        /// </summary>
        public double[] BBox { get; set; } = { };

        /// <summary>
        /// V1.0.0坐标系
        /// </summary>
        [EPSGValue("Srs")]
        public string Srs { get; set; } = "EPSG:4326";

        /// <summary>
        /// V1.1.0坐标系
        /// </summary>
        [EPSGValue("Crs")]
        public string Crs { get; set; } = "EPSG:4326";

        /// <summary>
        /// 样式类型
        /// </summary>
        public string Style { get; set; } = "";

        /// <summary>
        /// 背景是否透明
        /// </summary>
        public bool Transparent { get; set; } = false;

        /// <summary>
        /// 是否掩膜
        /// </summary>
        public bool IsMask { get; set; } = false;

        /// <summary>
        /// 背景色
        /// </summary>
        public string BGColor { get; set; } = "#000000";

        /// <summary>
        /// 图片格式
        /// </summary>
        [Required]
        [EnumValue("image/mixed", "image/png", "image/jpeg", "image/webp",
            ErrorMessage = "The Format value required value should be between [image/mixed,image/png,image/jpeg,image/webp].")]
        public string Format { get; set; } = "image/jpeg";

        /// <summary>
        /// 波段排列顺序
        /// </summary>
        public int[] Bands { get; set; } = { 3, 2, 1 };

        /// <summary>
        /// 服务类型
        /// </summary>
        [Required]
        [EnumValue("wms",
            ErrorMessage = "The Service value required value should be between [WMS].")]
        public string Service { get; set; } = "WMS";

        /// <summary>
        /// 请求类型
        /// </summary>
        [Required]
        [EnumValue("getcapabilities", "getmap",
            ErrorMessage = "The Request value required value should be between [GetCapabilities,GetMap].")]
        public string Request { get; set; } = "GetCapabilities";

        /// <summary>
        /// 版本号
        /// </summary>
        [Required]
        [EnumValue("1.0.0", "1.1.0", "1.1.1", "1.3.0",
            ErrorMessage = "The Version value required value should be between [1.0.0, 1.1.0, 1.1.1, 1.3.0")]
        public string Version { get; set; } = "1.1.1";

        /// <summary>
        /// 最大百分比拉伸(左)
        /// </summary>
        [Range(0d, 49.9d, ErrorMessage = "The PercentLeft must be between 0.0d and 49.9d.")]
        public double PercentLeft { get; set; } = 0;

        /// <summary>
        /// 最大百分比拉伸(右)
        /// </summary>
        [Range(0d, 49.9d, ErrorMessage = "The PercentRight must be between 0.0d and 49.9d.")]
        public double PercentRight { get; set; } = 0;

        /// <summary>
        /// Gamma拉伸
        /// </summary>
        [Range(0d, 2d, ErrorMessage = "The Gamma must be between 0.0d and 2.0d.")]
        public double Gamma { get; set; } = 0.8;
    }
}
